package com.hs.bai.handler;

import com.hs.dto.ResultBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author Bai Dingkun
 * @date 2022-06-22
 * @desc
 */
@RestControllerAdvice
@Slf4j
public class ControllerExceptionAdvice {

/*    @ExceptionHandler({NullPointerException.class})
    public ResultBean MethodArgumentNotValidExceptionHandler(NullPointerException e) {
        e.printStackTrace();
        log.error("检查数据是否完整！");
        return ResultBean.ERROR("检查数据是否完整！");
    }*/

    @ExceptionHandler({Exception.class})
    public ResultBean handleException(Exception e) {
        e.printStackTrace();
        log.error("错误=======================================");
        return ResultBean.ERROR("服务器繁忙！");
    }

}
